package com.us.usws.site.ws.entity.indexes.index;

import java.util.ArrayList;
import java.util.List;

import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;

import com.us.usws.model.domain.channel.Channel;
import com.us.usws.model.domain.video.Video;

@JsonPropertyOrder({ "id", "title", "picture", "url", "ui_type" })
public class WSIndexChannel {

	@JsonProperty("id")
	private String uid;

	@JsonProperty("title")
	private String name;

	private String picture;

	private String url;

	@JsonProperty("ui_type")
	private String uiType;

	private List<WSIndexChannelVideo> items;

	/**
	 * note this constructor will leave below fields as empty:
	 * url
	 * @param channel
	 * @param videos
	 */
	public WSIndexChannel(Channel channel, List<Video> videos) {
		this.uid = channel.getUid();
		this.name = channel.getName();
		this.picture = channel.getPicture();
		this.uiType = channel.getUiType();
		//empty of url

		if (videos != null) {
			items = new ArrayList<WSIndexChannelVideo>(videos.size());
			for (Video each : videos) {
				WSIndexChannelVideo oneV = new WSIndexChannelVideo(each);
				items.add(oneV);
			}
		}

	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUiType() {
		return uiType;
	}

	public void setUiType(String uiType) {
		this.uiType = uiType;
	}

	public List<WSIndexChannelVideo> getItems() {
		return items;
	}

	public void setItems(List<WSIndexChannelVideo> items) {
		this.items = items;
	}

}
